package change.service.dao;

import java.io.Serializable;
import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import change.service.entity.Change;

@Repository
public class ChangeDAO extends HibernateDaoSupport implements IChangeDAO, Serializable {

    private static final long serialVersionUID = 1L;
    
    @Autowired
    public void init(SessionFactory factory) {
        setSessionFactory(factory);
        createHibernateTemplate(factory);
    }
       
    public ChangeDAO() {
        // TODO Auto-generated constructor stub
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<Change> getAllChange() {
		System.out.println("on est dans change dao getAllChange");
		List<Change> localChange = getHibernateTemplate().find("from Change");
		System.out
				.println("on est dans change dao getAllChange avant de return");
		return localChange;
    }

    @Override
    public double getChange(String paramCountry) {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    protected HibernateTemplate createHibernateTemplate(
            org.hibernate.SessionFactory paramSessionFactory) {
        // TODO Auto-generated method stub
        return super.createHibernateTemplate(paramSessionFactory);
    }

    @Override
    protected void initDao() throws Exception {
        // TODO Auto-generated method stub
        super.initDao();
    }

    @Override
    public String createChange(Change paramChange) {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public boolean deleteChange(Change paramChange) {
        // TODO Auto-generated method stub
        return false;
    }

    
}
